load("//tools/build_defs/android:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

UTIL_EXPORTED_HEADERS = [
    "common.h",
    "ProcFs.h",
    "SysFs.h",
    "BaseStatFile.h",
    "hooks.h",
]

fb_xplat_cxx_library(
    name = "hooks",
    srcs = [
        "hooks.cpp",
    ],
    headers = [
        "hooks.h",
    ],
    header_namespace = "util",
    exported_headers = [
        "hooks.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-std=gnu++14",
        "-Wall",
    ],
    force_static = True,
    visibility = [
        profilo_path("cpp/..."),
        profilo_path("facebook/cpp/..."),
    ],
    deps = [
        profilo_path("deps/linker:linker"),
    ],
)

fb_xplat_cxx_library(
    name = "util",
    srcs = glob([
        "common.cpp",
        "ProcFs.cpp",
        "SysFs.cpp",
    ]),
    headers = glob(
        ["*.h"],
        exclude = UTIL_EXPORTED_HEADERS,
    ),
    header_namespace = "util",
    exported_headers = UTIL_EXPORTED_HEADERS,
    compiler_flags = [
        "-fexceptions",
        "-fPIC",
        "-std=gnu++14",
        "-Wall",
        "-Wno-missing-braces",
    ],
    force_static = True,
    tests = [
        profilo_path("cpp/util/test:procfs"),
    ],
    visibility = [
        profilo_path("..."),
    ],
)
